package com.justech.mes.utils.plugins.transfer.procer;


import com.justech.mes.utils.DateUtil;
import com.justech.mes.utils.NumberFormatUtil;
import com.justech.mes.utils.ObjectUtil;
import com.justech.mes.utils.plugins.transfer.annotation.Hourly;

/**
 * @author feifei.li
 */
public class HourlyProcer implements ConstraintProcer<Hourly, Long> {

    @Override
    public Object process(Hourly annotation, Long source) {
        if (ObjectUtil.isNull(source)) {
            return null;
        }
        return NumberFormatUtil.round(DateUtil.toHour(source));
    }
}
